package com.examples.chartdirector.PieCharts;

import javax.swing.JPanel;

import com.examples.chartdirector.ui.ChartPanel;

import ChartDirector.ChartViewer;
import ChartDirector.PieChart;

public class SimplePieChart extends ChartPanel {

	public static void createDemoPanel(JPanel chartContainer) {
		// The data for the pie chart
		double[] data = {25, 18, 15, 12, 8, 30, 35};

		// The labels for the pie chart
		String[] labels = {"Labor", "Licenses", "Taxes", "Legal", "Insurance", "Facilities", "Production"};

		// Create a PieChart object of size 640 x 350 pixels
		PieChart c = new PieChart(default_X_pixel, default_Y_pixel) {
		};

		// Set the center of the pie at (160, 160) and the radius to 100 pixels
		c.setPieSize(160, 160, 100);

		// Set the pie data and the pie labels
		c.setData(data, labels);
//		c.setOutputOptions("bmpScale=1.8;");

		// Output the chart
		ChartViewer viewer = new ChartViewer();
//		chartViewer1.setMouseWheelZoomRatio(1.1);
		viewer.setChart(c);

		// Include tool tip for the chart
		viewer.setImageMap(c.getHTMLImageMap("", "", "title='{label}: US${value}K ({percent}%)'"));
		showInCenter(chartContainer,viewer);
	}

}
